package cn.hairui.blog.mapper;

import cn.hairui.blog.model.Whisper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author lihairui
 * @version V1.0
 * @date: 2019/8/3 1:05
 */
@Mapper
public interface WhisperMapper {

    @Select("SELECT * FROM WHISPER WHERE SHOW_FLAG='Y' ORDER BY CREATETIME DESC")
    List<Whisper> findGust();

    @Select("SELECT * FROM WHISPER ORDER BY CREATETIME DESC")
    List<Whisper> list();

    @Select("SELECT T1.*,T2.NICKNAME,T2.PROPHOTO FROM WHISPERMESSAGE T1 ,USER T2 WHERE T1.WHISPER_ID=#{whisperId} AND T1.CREATOR=T2.USERNAME ORDER BY T1.CREATETIME DESC")
    List<Map> findMessageByWhisperId(int whisperId);
}
